<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head>
	<link rel="stylesheet" type="text/css" href="/static/css/layui.css" />
	<link rel="stylesheet" type="text/css" href="/static/css/style.css" />
	<link rel="stylesheet" type="text/css" href="/static/css/jobSeekers.css" />
</head>
<style>
	.originalFileName{
		display: inline-block;
		width: 200px;
		vertical-align: top;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
</style>
<body>
	<div class="iframe-page">
		<div class="flex-between page-box">
			<input type="hidden" id="memberId" th:value="${memberId}">
			<div class="left flex-between">
				<img class="thumb" id="avatar" src="/static/img/default.png">
				<div class="info_box">
					<div class="name" style="margin-bottom:10px;">
						<span class="t3" id="jobName"></span>
						<i class="layui-icon layui-icon-female" style="font-size: 16px; color: #1E9FFF;"></i>
					</div>
					<p class="text t5 opacity" id="advantage" style="margin-bottom:20px;"></p>
					<div class="t3" style="margin-bottom:10px;">求职意向</div>
					<div id="jobWant"></div>
					<div class="t3" style="margin-bottom:10px;">教育经历</div>
					<div id="jobSchool"></div>
					<div class="t3" style="margin-bottom:10px;">工作经验</div>
					<div id="businessExperience"></div>
				</div>
			</div>
			<div class="right">
				<div class="t3" style="margin-bottom:10px;">联系方式</div>
				<div class="box flex-between" style="margin-bottom:10px;">
					<div class="t4 flex-start">
						<i class="layui-icon layui-icon-cellphone"
							style="font-size: 24px; color: #1E9FFF;margin-right: 10px;"></i>
						<span>电话</span>
					</div>
					<div class="opacity t5" id="jobTel"></div>
				</div>
				<div class="box flex-between" style="margin-bottom:10px;">
					<div class="t4 flex-start">
						<i class="layui-icon layui-icon-login-wechat"
							style="font-size: 24px; color: #1E9FFF;margin-right: 10px;"></i>
						<span>微信</span>
					</div>
					<div class="opacity t5" id="jobVX"></div>
				</div>
				<div class="box flex-between" style="margin-bottom:20px;">
					<div class="t4 flex-start">
						<i class="layui-icon layui-icon-email"
							style="font-size: 24px; color: #1E9FFF;margin-right: 10px;"></i>
						<span>邮箱</span>
					</div>
					<div class="opacity t5" id="jobEmail"></div>
				</div>
				<div class="t3" style="margin-bottom:10px;">附件简历</div>
				<!-- 附件作品集 -->
				<div id="jobWorks"></div>
			</div>
		</div>
	</div>
	<script src="/static/layui/layui.js" type="text/javascript" charset="utf-8"></script>
	<script src="/static/js/jquery-3.6.0.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript" th:inline="javascript">
		layui.use(['layer'], function () {
			var layer = layui.layer;
			$.ajax({
				url: '/system/dlMember/getResume',
				data: { memberId: $("#memberId").val() },
				dataType: 'json',
				method: 'post',
				timeout: 10000,
				success: function (data) {
                    var entiry = data.entiry;
                    $("#avatar").attr("src", entiry.avatar)
                    $("#jobName").html(entiry.name)
                    $("#jobInfo").html(entiry.age + '&nbsp;|&nbsp;' + entiry.educationText + '&nbsp;&nbsp;&nbsp;&nbsp;' + entiry.status)
                    $("#advantage").html(entiry.advantage)//个人介绍
                    //求职意向 jobWant
                    var wantStr = "";
                    var cr = entiry.careerObjectives
						for (var i = 0; i < cr.length; i++) {
							wantStr += `<div class="position flex-start" style="margin-bottom:20px;">
							<img class="icon-img" src="/img/objective.png?t=1" />
							<p class="t5">`
									+ cr[i].position + '&nbsp;|&nbsp;' + cr[i].salaryMin + '-' + cr[i].salaryMin + '&nbsp;|&nbsp;' + cr[i].city +
									`</p></div>`
						}

					$('#jobWant').append(wantStr)
					//教育经历
					var schoolStr = "";
					var ed = entiry.educationalExperiences
					var education;
					if(ed.length > 0) {
						for (var i = 0; i < ed.length; i++) {
							switch (ed[i].education) {
								case 1:
									education = "初中及以下"
									break;
								case 2:
									education = "中专/中技"
									break;
								case 3:
									education = "高中"
									break;
								case 4:
									education = "大专"
									break;
								case 5:
									education = "本科"
									break;
								case 6:
									education = "硕士"
									break;
								case 7:
									education = "博士"
									break;
								default:
									break;
							}
							schoolStr += `<div class="position flex-start" style="align-items: inherit;margin-bottom:20px">
							<div class="flex-column" style="justify-content: flex-start;">
								 <img class="icon-img" src="/img/education.png" />
<!--								<i class="layui-icon layui-icon-more-vertical" style="font-size: 16px; color: #1E9FFF;margin-right: 10px;"></i>-->
								<i class="layui-icon layui-icon-more-vertical" style="font-size: 16px; color: #1E9FFF;margin-right: 10px;"></i>
							</div>
							<div><p class="t5 flex-between" style="margin-bottom:6px;"><span>`
									+ ed[i].schoolName + '&nbsp;|&nbsp;' + ed[i].major + '&nbsp;|&nbsp;' + education +
									`</span><span class="t6 opacity" style="margin-left:10px;">`
									+ ed[i].startYear + '-' + ed[i].graduateYear +
									`</span></p><p  class="t5 opacity line-clamp line-clamp2">` + ed[i].experience + `</p></div></div>`
						}
					}else{
						schoolStr = '<img class="null-img" src="/img/null-img.png" />';
					}

					$("#jobSchool").append(schoolStr)
					//工作经验
					var str = "";
					var workExperiences = entiry.workExperiences
					if(workExperiences.lenght > 0){
						for (var i = 0; i < workExperiences.length; i++) {
							str += `<div class="position flex-start" style="align-items: inherit;"><div class="flex-column" style="justify-content: flex-start;">
<!--							<i class="layui-icon layui-icon-female" style="font-size: 20px; color: #1E9FFF;margin-right: 10px;"></i>-->
<!--							<i class="layui-icon layui-icon-more-vertical" style="font-size: 20px; color: #1E9FFF;margin-right: 10px;"></i>-->
							<img class="icon-img" src="/img/work.png" />
<!--							<i class="layui-icon layui-icon-more-vertical" style="font-size: 20px; color: #1E9FFF;margin-right: 10px;"></i>-->
							<i class="layui-icon layui-icon-more-vertical" style="font-size: 20px; color: #1E9FFF;margin-right: 10px;"></i></div><div><p class="t5 flex-between"><span>`
									+ workExperiences[i].companyName + '&nbsp;|&nbsp;' + workExperiences[i].position +
									`</span><span class="t6 opacity" style="margin-left:10px">`
									+ workExperiences[i].startDate + '-' + workExperiences[i].leaveDate +
									`</span></p><div class="h6"></div><p class="t5 opacity line-clamp line-clamp2">`
									+ workExperiences[i].experience +
									`</p></div></div>`
						}
					}else{
						str = '<img class="null-img" src="/img/null-img.png" />';
					}
					$("#businessExperience").append(str)

					$('#jobTel').html(entiry.mobile)//电话
					$('#jobVX').html(entiry.wechat)//微信
					$('#jobEmail').html(entiry.email)//邮箱
					//附件信息
					var str1 = "";
					var attachedResumes = entiry.attachedResumes
					console.log("进入")
					console.log(entiry.attachedResumes)
					console.log(attachedResumes.lenght)
					if(attachedResumes.lenght > 0) {
						for (var i = 0; i < attachedResumes.length; i++) {
							str1 += `<div class="file-box flex-between"><div class="name t4">
							<i class="layui-icon layui-icon-about" style="font-size: 20px; color: #1E9FFF;margin-right: 10px;"></i><span class="originalFileName">`
									+ attachedResumes[i].originalFileName +
									`</span></div><div class="name t5"><span class="opacity">`
									+ getExactTime(attachedResumes[i].createTime) +
									`</span><a class="layui-icon layui-icon-download-circle" href="` + attachedResumes[i].path + `" download="` + attachedResumes[i].originalFileName + `" style="font-size: 20px; color: #1E9FFF;margin-left: 10px;"></a>
								</div>
							</div>`
						}
					}else{
						str1 = '<img class="null-img" src="/img/null-img.png" />';
					}
					$("#jobWorks").append(str1)
				}
			});
		//时间转换
		function getExactTime(time) {
			var date = new Date(time);
			var year = date.getFullYear() + '-';
			var month = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
			var dates = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + '  ';
			var hour = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
			var min = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
			var second = (date.getSeconds() < 10 ? '0' + date.getMinutes() : date.getMinutes());
			return year + month + dates + hour + min + second;
		}
    })
	</script>
</body>

</html>